package com.umeng.analytics.pro;

import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

class t extends SQLiteOpenHelper {
    static class t$a {
        private static final t a = new t(t.a(), v.a(t.a()), "ua.db", null, 1);

        private t$a() {

        }

        static t a() {
            return a;
        }
    }

    private String a;
    private static Context b;

    static {
        t.b = null;
    }

    private t(Context arg2, String arg3, SQLiteDatabase.CursorFactory arg4, int arg5) {
        super(arg2, arg3 == null || (arg3.equals("")) ? "ua.db" : arg3, arg4, arg5);
        this.a = null;
        this.b();
    }

    private t(Context arg2, String arg3, String arg4, SQLiteDatabase.CursorFactory arg5, int arg6) {
        this(new r(arg2, arg3), arg4, arg5, arg6);
    }


    static Context a() {
        return t.b;
    }

    public static t a(Context arg2) {
        t v0_1;
        Class v1 = t.class;
        synchronized (v1) {
            t.b = arg2;
            v0_1 = t.t$a.a();
        }
        return v0_1;
    }

    private void a(SQLiteDatabase arg2) {
        try {
            this.a = "create table if not exists __er(id INTEGER primary key autoincrement, __i TEXT, __a TEXT, __t INTEGER)";
            arg2.execSQL(this.a);
        } catch (SQLException v0) {
        }
    }

    private void b() {
        try {
            SQLiteDatabase v0_1 = this.getWritableDatabase();
            if (!v.a("__sd", v0_1)) {
                this.c(v0_1);
            }

            if (!v.a("__et", v0_1)) {
                this.b(v0_1);
            }

            if (v.a("__er", v0_1)) {
                return;
            }

            this.a(v0_1);
        } catch (Exception v0) {
        }
    }

    private void b(SQLiteDatabase arg2) {
        try {
            this.a = "create table if not exists __et(id INTEGER primary key autoincrement, __i TEXT, __e TEXT, __s TEXT, __t INTEGER)";
            arg2.execSQL(this.a);
        } catch (SQLException v0) {
        }
    }

    private void c(SQLiteDatabase arg2) {
        try {
            this.a = "create table if not exists __sd(id INTEGER primary key autoincrement, __ii TEXT unique, __a TEXT, __b TEXT, __c TEXT, __d TEXT, __e TEXT, __f TEXT, __g TEXT)";
            arg2.execSQL(this.a);
        } catch (SQLException v0) {
        }
    }

    public void onCreate(SQLiteDatabase arg2) {
        try {
            arg2.beginTransaction();
            this.c(arg2);
            this.b(arg2);
            this.a(arg2);
            arg2.setTransactionSuccessful();
        } catch (Exception v0_1) {
            v0_1.printStackTrace();
        } finally {
            arg2.endTransaction();
            return;
        }
    }

    public void onUpgrade(SQLiteDatabase arg1, int arg2, int arg3) {
    }
}

